import java.util.Scanner;

public class commodity {
    public static void main(String[] args) {
        double[] goods={52.80,35.00,53.40,26.25,26.50,28.50,26.80,28.60,34.80,31.50};
        //冒泡排序
        for (int i = 0; i < goods.length; i++) {
            for (int j = 0; j < goods.length-1-i; j++) {
                if(goods[j+1]>goods[j]){
                    double temp=goods[j+1];
                    goods[j+1]=goods[j];
                    goods[j]=temp;
                 }
            }
        }

        for (int i = 0; i < goods.length; i++) {
            System.out.printf(goods[i]+" ");
        }

        //换行
        System.out.println();

        //查找某个范围内的价格
        Scanner sc=new Scanner(System.in);
        while(true) {
            System.out.println("请输入查找商品的最低价格:");
            double sc1 = sc.nextDouble();
            System.out.println("请输入查找商品的最高价格:");
            double sc2 = sc.nextDouble();
            if (sc1 >= sc2 || sc1 < 0) {
                System.out.println("输入价格范围有误,请重新输入");
                continue;
            }

            System.out.println("满足您所查找的价格范围有:");
            for (int i = 0; i < goods.length; i++) {
                if(goods[i]>=sc1&&goods[i]<=sc2){
                    System.out.printf(goods[i]+" ");
                }
            }
            break;
        }


    }
}
